
<script type="text/javascript">
function scrollToEl(el){
    el = $(el);
    var text = el.get('html');
    el = $(text);
    if (typeof(el) == 'undefined' || el == null) return false;
    var position = el.getPosition();
    window.scrollTo(0,position.y);
}
en4.core.runonce.add(function(){
    var id = location.hash;
    id = id.substring(1,2);
    var  el = $(id);
    if (typeof(el) == 'undefined' || el == null) return false;
    var position = el.getPosition();
    window.scrollTo(0,position.y);
    
})
</script>
<?php
    if ($this->error == true){
        echo "<div><span class='tip'>".$this->translate('Find not found your field.')." </span></div>";
        return;
    }
 ?>
 <?php if ($this->error == false) :?>
<div>
    <div class="field_title">
        <span class="field_title_title"><?php echo $this->translate('references :: Definitions and Notes')?> </span>
        <span class="field_title_print">Print</span>
    </div>
    <div class="field_description">
        <?php echo $this->fieldObject->description ?>
    </div>
    
    <?php $beforeLecter = ''; $currentLecter = '';?>
    <?php 
        $aphabet = array(
            'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
        )
    ?>
    <div class="field_list_country">
        <table>
            <?php foreach($this->fields as $item): ?>
                <?php $currentLecter = substr($item->title,0,1); ?>
                <?php  if ($beforeLecter != $currentLecter):?>
                    <tr>
                        <td>
                            <div class="list_field_label"><a id="<?php echo ucfirst($currentLecter)?>" name="<?php echo ucfirst($currentLecter)?>"><?php echo $currentLecter?></a></div>
                            <div class="list_field_aphabet">
                                <div id="colAlpha">
                                    <?php  foreach ($aphabet as $value):?>
                                        <a onclick="scrollToEl(this); return false;" href="#<?php echo ucfirst($value)?>" class="<?php if ($value == ucfirst($currentLecter )) echo "aphabet_bold"?>"><?php echo $value?></a>
                                    <?php endforeach;?>
                                </div>
                            </div>
                        </td>
                    </tr>
                <?php endif; ?>
                <?php $beforeLecter = $currentLecter;?>
                <tr class="field_list_country_header">
                    <td><?php echo ucfirst( $item->title) ?></td>
                </tr>
            
            
                <tr class="field_list_country_body">
                    <td><?php echo $item->description ?></td>
                </tr>
            <?php endforeach; ?>
        </table>
    </div>
</div>
<?php endif; ?>